package com.comecrd.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;

@Configuration
public class MultipartConfig {
    
    @Bean
    public CommonsMultipartResolver multipartResolver() {
        CommonsMultipartResolver resolver = new CommonsMultipartResolver();
        // 设置最大上传文件大小
        resolver.setMaxUploadSize(104857600); // 100MB
        // 设置最大单个文件大小
        resolver.setMaxUploadSizePerFile(10485760); // 10MB
        // 设置默认编码
        resolver.setDefaultEncoding("UTF-8");
        return resolver;
    }
}